﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Entities.Portals;
    using DotNetNuke.Entities.Users;
    using Microsoft.VisualBasic;
    using System;
    using System.Web;

    public abstract class EventInterface
    {
        private static EventInterface objProvider = null;

        static EventInterface()
        {
            CreateProvider();
        }

        public virtual void AddItemToCart(int PortalID, int CartItemID)
        {
        }

        public virtual void AddToWishList(int PortalID, int ProductID, UserInfo UserInfo)
        {
        }

        public virtual void AutoResponse(int PortalID, NB_Store_CartInfo cart, HttpRequest Request)
        {
        }

        public virtual void CompletedOrder(int PortalID, int OrderType, int OrderID)
        {
        }

        public virtual void CreateOrder(int PortalID, int OrderID)
        {
        }

        private static void CreateProvider()
        {
            string storeSetting = SharedFunctions.GetStoreSetting(((PortalSettings) HttpContext.Current.Items["PortalSettings"]).PortalId, "event.provider");
            if (storeSetting != "")
            {
                string[] strArray = Strings.Split(storeSetting, ",", -1, CompareMethod.Binary);
                objProvider = (EventInterface) Activator.CreateInstance(strArray[0], strArray[1]).Unwrap();
            }
        }

        public virtual void DisplayProduct(int PortalID, int ProductID, UserInfo UserInfo)
        {
        }

        public virtual void DownloadDocument(int PortalID, int DocID, UserInfo UserInfo)
        {
        }

        public virtual void EditOrderUpdate(int PortalID, int OrderID)
        {
        }

        public virtual string getCategoryMessage(int PortalID, int CategoryID, UserInfo UserInfo)
        {
            return "";
        }

        public virtual string getSettingName(int PortalID, string SettingName, UserInfo UserInfo)
        {
            return SettingName;
        }

        public virtual string getSettingTextName(int PortalID, string SettingName, UserInfo UserInfo)
        {
            return SettingName;
        }

        public static EventInterface Instance()
        {
            return objProvider;
        }
    }
}

